Fix: Ensure st.set_page_config is first Streamlit call in Home page#97
Fix: Ensure st.set_page_config is first Streamlit call in Home page#97Devasy merged 4 commits intoDevasy:mainfrom
Conversation
❌ Deploy Preview for splitwizer failed. Why did it fail? →
|
|
Caution Review failedThe pull request is closed. WalkthroughThe import statements in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ui-poc/Home.py (1)
3-4: Remove unuseddatetimeandjsonimportsStatic analysis (ruff F401) flags both as unused. Eliminating dead imports reduces startup time and lint noise.
-from datetime import datetime -import json
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ui-poc/Home.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
ui-poc/Home.py
📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)
ui-poc/Home.py: Frontend POC must be implemented using Streamlit, with the entry point in ui-poc/Home.py.
Streamlit session state must be used to manage user sessions in the frontend, as shown in Home.py.
Files:
ui-poc/Home.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: Devasy23/splitwiser#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-26T09:41:01.332Z
Learning: Applies to ui-poc/Home.py : Frontend POC must be implemented using Streamlit, with the entry point in ui-poc/Home.py.
Learnt from: CR
PR: Devasy23/splitwiser#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-26T09:41:01.332Z
Learning: Applies to ui-poc/Home.py : Streamlit session state must be used to manage user sessions in the frontend, as shown in Home.py.
Learnt from: CR
PR: Devasy23/splitwiser#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-26T09:41:01.332Z
Learning: Applies to ui-poc/pages/*.py : Frontend POC application pages must be placed in ui-poc/pages/ as individual Python files.
Learnt from: CR
PR: Devasy23/splitwiser#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-26T09:41:01.332Z
Learning: Applies to ui-poc/pages/*.py : When adding a new UI component, modify or add files in /ui-poc/pages/.
ui-poc/Home.py (2)
Learnt from: CR
PR: Devasy23/splitwiser#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-26T09:41:01.332Z
Learning: Applies to ui-poc/Home.py : Frontend POC must be implemented using Streamlit, with the entry point in ui-poc/Home.py.
Learnt from: CR
PR: Devasy23/splitwiser#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-26T09:41:01.332Z
Learning: Applies to ui-poc/Home.py : Streamlit session state must be used to manage user sessions in the frontend, as shown in Home.py.
🪛 Ruff (0.12.2)
ui-poc/Home.py
3-3: datetime.datetime imported but unused
Remove unused import: datetime.datetime
(F401)
4-4: json imported but unused
Remove unused import: json
(F401)
🔇 Additional comments (1)
ui-poc/Home.py (1)
14-18: 👍 Clear explanatory comment addedThe note succinctly documents the Streamlit ordering rule and will help future contributors avoid the same pitfall.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
for more information, see https://pre-commit.ci
💠 Fix: Ensure
st.set_page_configis the first Streamlit command in Home page📄 Description
This PR fixes a critical bug in the
Home.pypage wherest.set_page_config()was being called after some other Streamlit-related imports or calls — which violates Streamlit’s requirement that this method must be the first Streamlit command executed.The error resolved was:
✅ Changes Made
st.set_page_config(...)to appear immediately afterimport streamlit as st, before all other imports or Streamlit-related code.🔍 Affected File
Home.py📌 Why this is necessary
Streamlit enforces
set_page_config()to be the very first Streamlit command — even before any imports that may usest.*. This was silently violated due to indirect Streamlit usage in early imports.🔪 Testing
StreamlitSetPageConfigMustBeFirstCommandError.Home.pyremain intact.Note: The behavior of
st.cachewas updated in Streamlit 1.36 to the new cachinglogic used by
st.cache_dataandst.cache_resource. This might lead to some problemsor unexpected behavior in certain edge cases.
Summary by CodeRabbit
Documentation
Style